package org.shiwen.week5.answer;

public class IsPrime {
    public static boolean isPrime(int n) {
        int x = (int)Math.sqrt(n);
        if (n <= 1){
            return false;
        } else if (n == 2) {
            return true;
        }
        for (int i = 2; i < x; i++) {
            if (n % i == 0) {
                return false;
            }
        }
        return true;
    }
}
